
// Copyright (C) 2007 Richard Uhler
// This file is part of Esiply.
//
// Esiply is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, Version 2,
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef _BLOCK_H_
#define _BLOCK_H_

// A block is a block of statements put together and wrapped in curly
// braces. For example:
// { printf("foo"); print("bar"); print("sludge");}
// 
// We treat it as a statement.

//#include <gc_allocator.h>
#include <vector>

#include "Statement.h"

class Value;
class String;
class Block : public Statement
{
public:
	Block();
    virtual Value* execute_internal(Scope* scope) const;
    virtual void getDeclaredVariables(std::vector<String* >& ids) const;

    void push_back(Statement* statement);
	int get_sync() const;
	void set_sync(int sync);
	void set_this(int isThis);
	void set_id(String* id);
private:
    std::vector<Statement* > m_statements;
	int m_sync;
	int m_this; //if synchronized(this){}  ---> m_this = 1 
	String* m_id; // else id = synchronized(id){}
};

#endif//_BLOCK_H_

